{include file="public/header"}

<body>
  <div class="layui-fluid">
    <div class="layui-row">
      <form action="" method="post" class="layui-form layui-form-pane">
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">客户姓名</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="title" name="name" value="{$row.name|default=''}" required="" lay-verify="required"
                autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">客户电话</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <input type="text" id="title" name="mobile" value="{$row.mobile|default=''}" autocomplete="off" class="layui-input" />
            </div>
          </div>
        </div>
        {if empty($admin->type)}
        <div class="layui-card layui-form" lay-filter="component-form-element">
          <div class="layui-card-header">组别</div>
          <div class="layui-card-body layui-row layui-col-space10">
            <div class="layui-col-md12">
              <select name="type" lay-verify="required">
                <option value="">组别</option>
                {foreach $cangku as $k => $v}
                <option value="{$k}" {if !empty($row.type) && $row.type==$k}selected{/if}>
                  {$v}</option>
                {/foreach}
              </select>
            </div>
          </div>
        </div>
       {/if}

        <!-- <div class="layui-card layui-form">
          <div class="layui-card-body layui-row layui-col-space10" id="area-picker">
            <div class="layui-col-md4">
              <select name="province" disabled class="province-selector" data-value="{$row.province|default=''}"
                lay-filter="province-1">
                <option value="">请选择省</option>
              </select>
            </div>
            <div class="layui-col-md4">
              <select name="city" class="city-selector" disabled data-value="{$row.city|default=''}"
                lay-filter="city-1">
                <option value="">请选择市</option>
              </select>
            </div>
            <div class="layui-col-md4">
              <select name="area" class="county-selector" disabled data-value="{$row.area|default=''}"
                lay-filter="county-1">
                <option value="">请选择区</option>
              </select>
            </div>
            <div class="layui-col-md12">
              <input type="text" name="address" disabled value="{$row.address|default=''}" required=""
                lay-verify="required" autocomplete="off" class="layui-input" placeholder="详细地址" />
            </div>
          </div>
        </div> -->
        <div class="layui-form-item">
          <input type="hidden" value="{$row['id']|default='0'}" name="id" />
          <button class="layui-btn" lay-submit="" lay-filter="add">提交</button>
        </div>
      </form>
    </div>
  </div>
  {include file="public/footer"}
  <script>
    layui.use(["form", "layer", "upload"], function () {
      $ = layui.jquery;
      var form = layui.form,
        upload = layui.upload,
        element = layui.element,
        layer = layui.layer;
      //监听提交
      form.on("submit(add)", function (data) {
        //发异步，把数据提交给php
        $.ajax({
          type: "post",
          data: data.field,
          success: function (res) {
            if (res.status == 0) {
              layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
              });
            } else {
              layer.msg(res.msg, { icon: 2, time: 1000 });
            }
          },
        });
        return false;
      });
    });
  </script>
</body>